package com.bsfcs.rag.controller;

import com.bsfcs.rag.service.ProjectTaskWorkHourService;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;

@RestController
@RequestMapping("/suggest")
public class SuggestionController {

    private final ProjectTaskWorkHourService projectTaskWorkHourService;


    SuggestionController(ProjectTaskWorkHourService projectTaskWorkHourService) {
        this.projectTaskWorkHourService = projectTaskWorkHourService;
    }


    @GetMapping("/project")
    public Flux<String> project(@RequestParam("projectId") String projectId) throws JsonProcessingException {
        return projectTaskWorkHourService.getProjectWithTasksAndWorkHoursAsJson(projectId);
    }
}
